#include"RingQueue.hpp"
#include"Thread.hpp"
#include<vector>
#include<string>
#include<iostream>
using namespace yjt;
int a=10;
using ringqueue_t=RingQueue<int>;

void Consumer(ringqueue_t &rq)
{
    
}
void Productor(ringqueue_t &rq)
{

}
void StartComm(vector<Thread<ringqueue_t>> *threads,int num,ringqueue_t &bq,func_t<ringqueue_t> func)
{
    for(int i=0;i<num;i++)
    {
        string name="thread-"+to_string(i+1);
        threads->emplace_back(func,bq,name);
        threads->back().Start();
    }
}
void StartConsumer(vector<Thread<ringqueue_t>> *threads,int num,ringqueue_t &bq)
{
    StartComm(threads,num,bq,Consumer);
}

void StartProductor(vector<Thread<ringqueue_t>> *threads,int num,ringqueue_t &bq)
{
    StartComm(threads,num,bq,Productor);
}
void WaitAllThread(vector<Thread<ringqueue_t>> &threads)
{
    for(auto &thread:threads)
    {
        thread.Join();
    }
}
int main()
{
    ringqueue_t *rq=new ringqueue_t(5); 
    vector<Thread<ringqueue_t>> threads;

    StartConsumer(&threads,1,*rq);
    StartProductor(&threads,1,*rq);
    WaitAllThread(threads);
    return 0;
}